package org.third.security.idm.saml;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.Charset;

import org.third.common.utils.StreamUtils;

public class SamlMessageTest {

    static final String samlMessage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><saml2p:LogoutRequest xmlns:saml2p=\"urn:oasis:names:tc:SAML:2.0:protocol\" Destination=\"https://sgdlitvm0769.adfshp.com/adfs/ls/\" ID=\"adfc2i7ehj16egd3a6947ddieh8j7a\" IssueInstant=\"2016-08-10T03:12:58.275Z\" Version=\"2.0\"><saml2:Issuer xmlns:saml2=\"urn:oasis:names:tc:SAML:2.0:assertion\">https://gongyo2.asiapacific.hpqcorp.net:8443/idm-service/saml/metadata</saml2:Issuer><saml2:NameID xmlns:saml2=\"urn:oasis:names:tc:SAML:2.0:assertion\">zhangé张</saml2:NameID><saml2p:SessionIndex>_51305203-0fe2-4cf9-b782-3db4ea2ffb5f</saml2p:SessionIndex></saml2p:LogoutRequest>";

    public static void main(String[] args) {
        try {
            InputStream inputStream = new ByteArrayInputStream(samlMessage.getBytes());
            String xml = StreamUtils.streamToString(inputStream, Charset.defaultCharset());
            System.out.println(xml);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
